/**
 * 
 */
package com.shop.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.shop.entities.Product;
import com.shop.repositories.ProductRepository;

/**
 * @author Siva
 *
 */
@Service
@Transactional
public class ProductService 
{
	@Autowired private ProductRepository productRepository;
	
	public void addProduct(Product p) {
		productRepository.addProduct(p);
	}
	
	public Product findProductById(Integer id) {

		return productRepository.findProductById(id);
	}

	public List<Product> findProductsByCategoryId(Integer id) {

		return productRepository.findProductsByCategoryId(id);

	}

	public List<Product> findAllProducts() {

		return productRepository.findAllProducts();
	
	}
	
	public void updateProducts(Product p) {

		 productRepository.updateProduct(p);
	
	}
	
	public void deleteProduct(Product p) {
		
		productRepository.deleteProduct(p);
	
	}
	
	
}
